package com.maoyu.cloud.error.config;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;

@Configuration
public class CloudErrorPage implements ErrorPageRegistrar {
    @Override
    public void registerErrorPages(ErrorPageRegistry registry) {
        registry.addErrorPages(new ErrorPage(HttpStatus.FORBIDDEN,"/error/page403"));
        registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND,"/error/page404"));
        registry.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST,"/error/page400"));
        registry.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,"/error/page500"));
    }

}